package com.yc.blog.springboot.mixview.ctr;

import javax.servlet.http.HttpServletRequest;

import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.servlet.ModelAndView;

/**
 * 带参数
 */
@Controller
public class DemoController2 {

	/**
	 * 跳转页面<p>
	 * 方式：返回ModelAndView<p>
	 * @return
	 */
	@RequestMapping("/c2-1")
	public ModelAndView c1(HttpServletRequest request, @RequestParam("name") String myName, Integer age) {
		System.out.println("--------c1-1---------myName=" + myName + ", age=" + age);
		
		ModelAndView mv = new ModelAndView();
		
		mv.setViewName("page2");//指定页面
		
		mv.addObject("para1", "aaaaa");//绑定参数1
		mv.addObject("para2", "bbbbb");//绑定参数2
		
		return mv;
	}
	
	
}
